** Explaining Military Coups and Impeachments in Latin America
** Anibal Perez-Linan & John Polga-Hecimovich
** Democratization 2017
** Updated: September 27, 2016

use "Democratization.dta", clear

* Table 3
* 3.1 Independent Choice (Multinomial)
mprobit ousted  pgdp gpgdp demonst rad_all legacy_mc context_mc p_h npr_all t t2 t3, cluster(cowcode)

* 3.2 Conditional Choice (Heckman)
heckprob  coup                                         legacy_mc context_mc p_h npr_all  ///
        , select(interrupt= pgdp gpgdp demonst rad_all legacy_mc context_mc p_h npr_all  t t2 t3 ///
		) cluster(cowcode)
			
* Figure 1
* Economic performance 
margins, at(gpgdp=(-8(2)8)) predict(p11) /* Coup */
marginsplot, saving(g13, replace) noci title("1.1.2 Coup") plotopts(msymbol(p)) 
margins, at(gpgdp=(-8(2)8)) predict(p01) /* Legal */
marginsplot, saving(g12, replace) noci title("1.1.1 Legal") plotopts(msymbol(p))
margins, at(gpgdp=(-8(2)8)) predict(p00) /* No ousting */ 
marginsplot, saving(g11, replace) noci title("Survival") plotopts(msymbol(p))
* Mass protest
margins, at(demonst=(0(1)5)) predict(p11) /* Coup */
marginsplot, saving(g23, replace) noci title("1.2.2 Coup") plotopts(msymbol(p)) 
margins, at(demonst=(0(1)5)) predict(p01) /* Legal */
marginsplot, saving(g22, replace) noci title("1.2.1 Legal") plotopts(msymbol(p))
margins, at(demonst=(0(1)5)) predict(p00) /* No ousting */ 
marginsplot, saving(g21, replace) noci title("Survival") plotopts(msymbol(p))
* Radicalism
margins, at(rad_all=(0(.2)1)) predict(p11) /* Coup */
marginsplot, saving(g33, replace) noci title("1.3.2 Coup") plotopts(msymbol(p)) 
margins, at(rad_all=(0(.2)1)) predict(p01) /* Legal */
marginsplot, saving(g32, replace) noci title("1.3.1 Legal") plotopts(msymbol(p))
margins, at(rad_all=(0(.2)1)) predict(p00) /* No ousting */ 
marginsplot, saving(g31, replace) noci title("Survival") plotopts(msymbol(p))

graph combine ///
              g12.gph g22.gph g32.gph  ///
			  g13.gph g23.gph g33.gph  ///
      , ycommon cols(3) saving(Figure_1, replace)	  

* Figure 2
* Regional Context 
margins, at(context_mc=(0(2)10)) predict(p11) /* Coup */
marginsplot, saving(g43, replace) noci title("2.1.2 Coup") plotopts(msymbol(p)) 
margins, at(context_mc=(0(2)10)) predict(p01) /* Legal */
marginsplot, saving(g42, replace) noci title("2.1.1 Legal") plotopts(msymbol(p))
margins, at(context_mc=(0(2)10)) predict(p00) /* No ousting */ 
marginsplot, saving(g41, replace) noci title("Survival") plotopts(msymbol(p))
* Party
margins, at(p_h=(20(10)60)) predict(p11) /* Coup */
marginsplot, saving(g53, replace) noci title("2.2.2 Coup") plotopts(msymbol(p)) 
margins, at(p_h=(20(10)60)) predict(p01) /* Legal */
marginsplot, saving(g52, replace) noci title("2.2.1 Legal") plotopts(msymbol(p))
margins, at(p_h=(20(10)60)) predict(p00) /* No ousting */ 
marginsplot, saving(g51, replace) noci title("Survival") plotopts(msymbol(p))
* Support for democracy
margins, at(npr_all=(-.5(.25)1)) predict(p11) /* Coup */
marginsplot, saving(g63, replace) noci title("2.3.2 Coup") plotopts(msymbol(p)) 
margins, at(npr_all=(-.5(.25)1)) predict(p01) /* Legal */
marginsplot, saving(g62, replace) noci title("2.3.1 Legal") plotopts(msymbol(p))
margins, at(npr_all=(-.5(.25)1)) predict(p00) /* No ousting */ 
marginsplot, saving(g61, replace) noci title("Survival") plotopts(msymbol(p))
	  
graph combine ///
              g42.gph g52.gph g62.gph  ///
			  g43.gph g53.gph g63.gph  ///
      , ycommon cols(3) saving(Figure_2, replace)	
	  

	 